home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Arsenal / OS2 Arsenal v1.0 (Disc 2)(Arsenal Computer).ISO / os2_inet / progcsd.exe / RPC_MSG.H < prev    next >
Text File  |  1992-11-12  |  7KB  |  233 lines

  1. /********************************************************copyrite.xmc***/
  2. /*                                                                     */
  3. /*   Licensed Materials - Property of IBM                              */
  4. /*                                                                     */
  5. /*   This module is "Restricted Materials of IBM":                     */
  6. /*      Program Number:   5798RXW                                      */
  7. /*      Program Name:     IBM TCP/IP Version 1.2 for OS/2              */
  8. /*   (C) Copyright IBM Corporation. 1990, 1991.                        */
  9. /*                                                                     */
  10. /*   See IBM Copyright Instructions.                                   */
  11. /*                                                                     */
  12. /********************************************************copyrite.xmc***/
  13. /*
  14.  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  15.  * unrestricted use provided that this legend is included on all tape
  16.  * media and as a part of the software program in whole or part.  Users
  17.  * may copy or modify Sun RPC without charge, but are not authorized
  18.  * to license or distribute it to anyone else except as part of a product or
  19.  * program developed by the user.
  20.  *
  21.  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
  22.  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  23.  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
  24.  *
  25.  * Sun RPC is provided with no support and without any obligation on the
  26.  * part of Sun Microsystems, Inc. to assist in its use, correction,
  27.  * modification or enhancement.
  28.  *
  29.  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  30.  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
  31.  * OR ANY PART THEREOF.
  32.  *
  33.  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
  34.  * or profits or other special, indirect and consequential damages, even if
  35.  * Sun has been advised of the possibility of such damages.
  36.  *
  37.  * Sun Microsystems, Inc.
  38.  * 2550 Garcia Avenue
  39.  * Mountain View, California  94043
  40.  */
  41. /*      @(#)rpc_msg.h 1.1 86/02/03 SMI      */
  42.  
  43. /*
  44.  * rpc_msg.h
  45.  * rpc message definition
  46.  *
  47.  * Copyright (C) 1984, Sun Microsystems, Inc.
  48.  */
  49. #ifndef INCL_RPC_RPC_MSG
  50. #define INCL_RPC_RPC_MSG
  51. #ifndef __32BIT__
  52. #define _Packed
  53. #define _Seg16
  54. #define _Far16
  55. #define _Cdecl
  56. #endif
  57.  
  58. #include <rpc\xdr.h>
  59. #define RPC_MSG_VERSION         ((u_long) 2)
  60. #define RPC_SERVICE_PORT        ((u_short) 2048)
  61.  
  62. /*
  63.  * Bottom up definition of an rpc message.
  64.  * NOTE: call and reply use the same overall stuct but
  65.  * different parts of unions within it.
  66.  */
  67.  
  68. enum msg_type {
  69.         CALL=0,
  70.         REPLY=1
  71. #ifdef __32BIT__
  72.         , XXXX_DUMMY=32767
  73. #endif
  74. };
  75.  
  76. enum reply_stat {
  77.         MSG_ACCEPTED=0,
  78.         MSG_DENIED=1
  79. #ifdef __32BIT__
  80.         , XXXY_DUMMY=32767
  81. #endif
  82. };
  83.  
  84. enum accept_stat {
  85.         SUCCESS=0,
  86.         PROG_UNAVAIL=1,
  87.         PROG_MISMATCH=2,
  88.         PROC_UNAVAIL=3,
  89.         GARBAGE_ARGS=4,
  90.         SYSTEM_ERR=5
  91. #ifdef __32BIT__
  92.         , XXXZ_DUMMY=32767
  93. #endif
  94. };
  95.  
  96. enum reject_stat {
  97.         RPC_MISMATCH=0,
  98.         AUTH_ERROR=1
  99. #ifdef __32BIT__
  100.         , XXXA_DUMMY=32767
  101. #endif
  102. };
  103.  
  104. /*
  105.  * Reply part of an rpc exchange
  106.  */
  107.  
  108. /*
  109.  * Reply to an rpc request that was accepted by the server.
  110.  * Note: there could be an error even though the request was
  111.  * accepted.
  112.  */
  113. _Packed struct accepted_reply {
  114.         _Packed struct opaque_auth      ar_verf;
  115.         enum accept_stat        ar_stat;
  116.         union {
  117.                 struct {
  118.                         u_long  low;
  119.                         u_long  high;
  120.                 } AR_versions;
  121.                 struct {
  122.                         char * _Seg16 where;
  123. #ifdef __32BIT__
  124. #pragma checkout(suspend)
  125. #endif
  126.                         bool_t (* _Seg16 _Far16 _Cdecl proc)();
  127. #ifdef __32BIT__
  128. #pragma checkout(resume)
  129. #endif
  130.                 } AR_results;
  131.                 /* and many other null cases */
  132.         } ru;
  133. #define ar_results      ru.AR_results
  134. #define ar_vers         ru.AR_versions
  135. };
  136.  
  137. /*
  138.  * Reply to an rpc request that was rejected by the server.
  139.  */
  140. _Packed struct rejected_reply {
  141.         enum reject_stat rj_stat;
  142.         union {
  143.                 struct {
  144.                         u_long low;
  145.                         u_long high;
  146.                 } RJ_versions;
  147.                 enum auth_stat RJ_why;  /* why authentication did not work */
  148.         } ru;
  149. #define rj_vers ru.RJ_versions
  150. #define rj_why  ru.RJ_why
  151. };
  152.  
  153. /*
  154.  * Body of a reply to an rpc request.
  155.  */
  156. _Packed struct reply_body {
  157.         enum reply_stat rp_stat;
  158.         union {
  159.                 _Packed struct accepted_reply RP_ar;
  160.                 _Packed struct rejected_reply RP_dr;
  161.         } ru;
  162. #define rp_acpt ru.RP_ar
  163. #define rp_rjct ru.RP_dr
  164. };
  165.  
  166. /*
  167.  * Body of an rpc request call.
  168.  */
  169. _Packed struct call_body {
  170.         u_long cb_rpcvers;      /* must be equal to two */
  171.         u_long cb_prog;
  172.         u_long cb_vers;
  173.         u_long cb_proc;
  174.         _Packed struct opaque_auth cb_cred;
  175.         _Packed struct opaque_auth cb_verf; /* protocol specific - provided by client */
  176. };
  177.  
  178. /*
  179.  * The rpc message
  180.  */
  181. _Packed struct rpc_msg {
  182.         u_long                  rm_xid;
  183.         enum msg_type           rm_direction;
  184.         union {
  185.                 _Packed struct call_body RM_cmb;
  186.                 _Packed struct reply_body RM_rmb;
  187.         } ru;
  188. #define rm_call         ru.RM_cmb
  189. #define rm_reply        ru.RM_rmb
  190. };
  191. #define acpted_rply     ru.RM_rmb.ru.RP_ar
  192. #define rjcted_rply     ru.RM_rmb.ru.RP_dr
  193.  
  194.  
  195. /*
  196.  * XDR routine to handle a rpc message.
  197.  * xdr_callmsg(xdrs, cmsg)
  198.  *      XDR *xdrs;
  199.  *      struct rpc_msg *cmsg;
  200.  */
  201. #if 0
  202. extern bool_t   _Far16 _Cdecl xdr_callmsg();
  203. #endif
  204.  
  205. /*
  206.  * XDR routine to pre-serialize the static part of a rpc message.
  207.  * xdr_callhdr(xdrs, cmsg)
  208.  *      XDR *xdrs;
  209.  *      struct rpc_msg *cmsg;
  210.  */
  211. #if 0
  212. extern bool_t   _Far16 _Cdecl xdr_callhdr();
  213. #endif
  214.  
  215. /*
  216.  * XDR routine to handle a rpc reply.
  217.  * xdr_replymsg(xdrs, rmsg)
  218.  *      XDR *xdrs;
  219.  *      struct rpc_msg *rmsg;
  220.  */
  221. #if 0
  222. extern bool_t   _Far16 _Cdecl xdr_replymsg();
  223. #endif
  224.  
  225. /*
  226.  * Fills in the error part of a reply message.
  227.  * _seterr_reply(msg, error)
  228.  *      struct rpc_msg *msg;
  229.  *      struct rpc_err *error;
  230.  */
  231. extern void     _Far16 _Cdecl _seterr_reply(void * _Seg16,void * _Seg16);
  232. #endif
  233.